-
Which is bigger, 0x0400 or 1,000?
-
How does the number of bits affect the biggest possible number you can hold?
-
Convert the bit pattern 0101 0010 0110 1011 to hexadecimal.
-
Can you think of an easy way to decide whether a number is even or odd just by looking at its binary representation.
Answers
-
0x0400 is bigger as it is 1,024 in decimal
-
If you have 8 bits you can hold ( 1+2+4+8+16+32+64+128 ) = 255 as your highest value, and 0 as your smallest, giving a range of 0-255, or 256 possible values. Each time we add a bit we double the possible range, i.e. moving to 9 bits gives us 512 possible values
-
0101 is 4+1=5, 0010 is 2, 0110 is 4+2=6, 1011 is 11, giving a value of 0x526B(remember that B is the hex value for 11)
-
For all odd numbers, the bottom bit is always 1, for even numbers, the bottom bit is always 0.